﻿<Dialogs:DialogWindow x:Class="Mnk.TBox.Plugins.Searcher.Components.SearchDialog"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:loc="clr-namespace:Mnk.TBox.Plugins.Searcher.Code.Localization"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:WPFSyntaxHighlighter="clr-namespace:Mnk.Library.WpfSyntaxHighlighter;assembly=Mnk.Library.WPFSyntaxHighlighter"
             xmlns:Dialogs="clr-namespace:Mnk.Library.WpfControls.Dialogs;assembly=Mnk.Library.WPFControls"
                      xmlns:Components="clr-namespace:Mnk.Library.WpfControls.Components;assembly=Mnk.Library.WPFControls"
                            xmlns:Settings="clr-namespace:Mnk.Rat;assembly=Mnk.Rat"
                      xmlns:captioned2="clr-namespace:Mnk.Library.WpfControls.Components.Captioned;assembly=Mnk.Library.WPFControls"
                      xmlns:components="clr-namespace:Mnk.TBox.Plugins.Searcher.Components"
                      mc:Ignorable="d" 
            ShowInTaskbar="True" Title="{loc:Tr PluginName}"
            Width="512" Height="400"
            MinWidth="480" MinHeight="320"
            Icon="/Mnk.TBox.Plugins.Searcher;component/Resources/Icon.ico">
    <Dialogs:DialogWindow.Resources>
        <ContextMenu  x:Key="RowMenu" >
            <MenuItem Header="{loc:Tr Edit}" Click="ContextMenuEdit"/>
            <MenuItem Header="{loc:Tr GoToFile}" Click="ContextMenuGoToFile"/>
            <Separator/>
            <MenuItem Header="{loc:Tr CopyFilePath}" Click="ContextMenuCopyFilePath"/>
            <MenuItem Header="{loc:Tr CopyFileName}" Click="ContextMenuCopyFileName"/>
        </ContextMenu>
        <Style x:Key="DefaultRowStyle" TargetType="{x:Type DataGridRow}">
            <Setter Property="ContextMenu" Value="{StaticResource RowMenu}" />
        </Style>
    </Dialogs:DialogWindow.Resources>
    <DockPanel>
        <StatusBar DockPanel.Dock="Bottom">
            <StatusBarItem Content="{loc:Tr SearchTime}"/>
            <StatusBarItem Name="sbiSearchTime"/>
            <StatusBarItem Content="{loc:Tr FillResultsTime}"/>
            <StatusBarItem Name="sbiFillResultsTime"/>
            <StatusBarItem Content="{loc:Tr LoadFileTime}"/>
            <StatusBarItem Name="sbiLoadFileTime"/>
            <StatusBarItem Content="{loc:Tr Files}"/>
            <StatusBarItem Name="sbiFiles"/>
            <StatusBarItem Content="{loc:Tr Words}"/>
            <StatusBarItem Name="sbiWords"/>
            <StatusBarItem HorizontalAlignment="Right">
                <Button Content="{loc:Tr Cancel}" Padding="5,0" IsCancel="True" Click="CancelClick"/>
            </StatusBarItem>
        </StatusBar>
        <DockPanel DockPanel.Dock="Top">
            <Label Content="{loc:Tr Word}" Width="50" />
            <Button Content="{loc:Tr Go}" Name="btnSearch" IsEnabled="false" DockPanel.Dock="Right" Margin="5"  Click="SearchClick"/>
            <Components:AutoComboBox Name="SearchText" IsEditable="True"  Margin="5" KeyUp="CbSearchTextKeyUp" Text="{Binding Search.SearchText}" ItemsSource="{Binding Search.LastSearchValues}" SelectionChanged="SelectedTextChanged"/>
        </DockPanel>
        <DockPanel DockPanel.Dock="Top">
            <Label Content="{loc:Tr Folder}" Width="50"/>
            <ComboBox Name="FoldersFilter" IsEditable="False" Margin="5" SelectionChanged="NeedSearch"/>
        </DockPanel>
        <DockPanel DockPanel.Dock="Right">
            <captioned2:CaptionedComboBox Caption="{loc:Tr SearchCount}" Name="cbCount" Margin="5" DockPanel.Dock="Top" SelectedIndexChanged="NeedSearch" Value="{Binding Search.FileCount}"/>
            <captioned2:CaptionedEnumDropDownList Caption="{loc:Tr SearchType}" Margin="5" DockPanel.Dock="Top" SelectedIndexChanged="NeedSearch" SourceEnumType="Settings:CompareType" Value="{Binding Search.CompareType}"/>
            <captioned2:CaptionedEnumDropDownList Caption="{loc:Tr SearchMode}" Margin="5" DockPanel.Dock="Top" SelectedIndexChanged="NeedSearch" SourceEnumType="Settings:SearchMode" Value="{Binding Search.SearchMode}"/>
            <Components:ExtCheckBox Content="{loc:Tr CaseSensitiveSearch}" Margin="10,5" DockPanel.Dock="Top" ValueChanged="NeedSearch" IsChecked="{Binding Search.MatchCase}"/>
            <Components:ExtCheckBox Content="{loc:Tr FullTextSearch}" Margin="10,5" DockPanel.Dock="Top" ValueChanged="NeedSearch" IsChecked="{Binding Search.FullTextSearch}"/>
            <GroupBox Header="{loc:Tr FileTypes}" Margin="3">
                <DockPanel>
                    <Components:PanelToICheckable DockPanel.Dock="Bottom" Name="FileTypesPanel" PanelHorizontalAlignment="Right"/>
                    <Components:CheckableListBox Name="FileTypes" Margin="5" ItemsSource="{Binding Index.FileTypes}" OnCheckChanged="NeedSearch"/>
                </DockPanel>
            </GroupBox>
        </DockPanel>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition MinHeight="64"/>
                <RowDefinition Height="5"/>
                <RowDefinition MinHeight="64"/>
            </Grid.RowDefinitions>
            <DataGrid Name="lvResult" DockPanel.Dock="Top" AutoGenerateColumns="True" DataContext="{Binding}" MouseDoubleClick="LvResultMouseDoubleClick" SelectionChanged="LvResultSelectedIndexChanged" CanUserResizeColumns="True" CanUserResizeRows="False" CanUserSortColumns="True" SelectionMode="Single" IsReadOnly="True" ColumnWidth="*" RowStyle="{StaticResource DefaultRowStyle}" />
            <GridSplitter Grid.Row="1" ResizeDirection="Rows" HorizontalAlignment="Stretch" />
            <WPFSyntaxHighlighter:SyntaxHighlighter Grid.Row="2" Name="edText" IsReadOnly="True"/>
        </Grid>
    </DockPanel>
</Dialogs:DialogWindow>
